from get_from_database import get_from_database
from preliminary import preliminary
from merge import merge
from procJson import procJson
from storeData import storeData
from storeTree import storeTree
clusters_list = ['5', '10', '15', '20', '25', '30', '35', '40']

def processData(id):
    try:
        tf = open("sourcedata/" + id + "_raw.json", 'r'); tf.close()
        print("Raw Json File Found")
    except:
        print("No Json Found, Fetching from DB")
        get_from_database(id)
    preliminary(id)
    for c in clusters_list:
        print("Current: " + id + "_" + c)
        merge(id + "_" + c)
        procJson(id + "_" + c)
        db = storeData(id + "_" + c)
    #storeTree(db, id)
